#!/bin/bash

function fibonacci {
    if [ $1 -eq 0 ]; then
	return 0;
    fi
    if [ $1 -eq 1 ]; then
	return 1;
    fi
	A=`expr $1 - 1`;
	B=`expr $1 - 2`;
	FA=`fibonacci $A`;
	FB=`fibonacci $B`;
	echo "fA=$FA,fb=$FB";
	R=`expr $FA + $FB `;
    return $R;
}

function fibonacci_sequence {
    	if [ $1 -eq $2 ]; then
	    return;
	fi

	echo `fibonacci $1`;
	N=`expr $1 + 1`;
	fibonacci_sequence $N $2 ;
}

fibonacci_sequence 0 20 ;

